
function submitSearch() {
    $("#searchTable").submit();
}

function resetSearch() {
    $("#numSelect").textbox("setValue","");
    $("#typeSelect").combobox("setValue","");
    $("#markSelect").combobox("setValue","");
}

function formatAction(value,row,index) {
//		var a = '<input type="button" value="详情" class="input" onclick="invest_see('+row.invest_id+');">';
    // var a = '<a href="../../invest/invest/invest_see?invest_id='+row.invest_id+'">详情</a>';
    var a='';
    var b = '';
    var c = '';
    if (row.invest_status_id == 4)
    {
        var b = '&nbsp;&nbsp;&nbsp;<input type="button" value="放标" class="input" onclick="invest_open('+row.invest_id+');">';
        var c = '&nbsp;&nbsp;&nbsp;<input type="button" value="取消" class="input" onclick="invest_cancel('+row.invest_id+');">';
    }
    return a+b+c;
}

function invest_see(invest_id) {
    window.parent.addTab('投资项目详细信息','../../invest/invest/invest_see?invest_id='+invest_id);
}

function invest_open(invest_id)
{
    var url = "../../invest/invest/invest_open";
    $.ajax({
        type: "POST",
        async: true,
        data: {"openData":invest_id},
        url: url,
        success: function(d)
        {
            // console.log(d);
            if (d == 1)
            {
                window.location.reload();
            }
            else
            {
                alert('操作失败，请尝试重新操作或联系管理员！');
                window.history.back();
            }
        },
        error: function(e)
        {
            alert(e);
        }
    });
}

function invest_cancel(invest_id)
{
    var url = "../../invest/invest/invest_cancel";
    $.ajax({
        type: "POST",
        async: true,
        data: {"cancelData":invest_id},
        url: url,
        success: function(d)
        {
            // console.log(d);
            if (d == 1)
            {
                window.location.reload();
            }
            else
            {
                alert('操作失败，请尝试重新操作或联系管理员！');
                window.history.back();
            }
        },
        error: function(e)
        {
            alert(e);
        }
    });
}

function invest_add()
{
    window.parent.addTab("投资项目新增","../../invest/invest/invest_add");
}